<template>
  <li class="cjy-page-body-commodity-li" :class="{'cjy-item-line':!isLastItem}">
    <div>
      <div class="cjy-page-bod-commodity-box">
        <div @click="gotoDetail" class="cjy-page-image-box">
          <img v-lazy="comInfor.mainPic" class="cjy-page-image-box-img">
        </div>
        <div class="cjy-page-Info-box">
          <div @click="gotoDetail">
            <div class="cjy-page-title-box">
            <span style="width: 100%;font-size: 0.65rem">
              {{goodsName || '\r'}}</span>
            </div>
            <div class="cjy-label-box">
              <!-- <div class="cjy-label-box-left">
                <div class="textOverflow" style="line-height:0.9rem;font-size: 0.7rem;color:black
">
                  {{labellistFir}}
                </div>
                <div class="textOverflow" style="line-height: 0.7rem;font-size: 0.6rem;color: #999999">{{labellistThir}}
                </div>
              </div>
              <div class="cjy-label-box-middle" v-if="labellistFir||labellistThir||labellistSec||labellistFor">
              </div>

              <div class="cjy-label-box-right">
                <div class="textOverflow" style="line-height:0.9rem;font-size: 0.7rem;color:black">
                  {{labellistSec}}
                </div>
                <div class="textOverflow" style="line-height: 0.7rem;font-size: 0.6rem;color: #999999">{{labellistFor}}
                </div>
              </div> -->
              <!-- <p class="cjy-label-box-weighing" v-if="goodsSpec">
                规格：{{goodsSpec}}
              </p> -->
            </div>
            <div class="cjy-page-label-box">
              <p>
                <span v-for="(item,index) in regularLabel " class="regular-label" :key="index">
                  {{item}}
                </span>
              </p>
              
              <!-- <span v-if="goodsDeliveryType" class="regular-label"
                    style="color: #9a9a9a;  border:0.5px solid #9a9a9a;">
              明日送达
            </span> -->
            </div>
            <div v-if="showNormalPrice!=showWsPrice">
              <div class="normal-price">
                ￥{{showNormalPrice}}
              </div>
            </div>
          </div>
          <div class="cjy-page-price-box">
            <span style="color:#ff2600;font-size: 0.8rem;display: inline-block;width: 0.7rem">￥</span><span
            class="cjy-price">{{showWsPrice}}</span><span
            class="cjy-price-unit"
            v-if="showUnit">/{{showUnit}}</span>
          </div>
          <update-cart
            :addCartButtonType="0"
            ref="updateCart"
            :commodityInfor="comInfor"
            :goodsId="goodsId"
            :foodCart="true">
            <div slot="button" slot-scope="props"
                 class="cjy-add-cart-button-box">
              <button-change-cart-icon v-if="goodsPrice && props.stockCount > 0 && props.number == 0"
                                       :type="1" class="buttonIcon"
                                       :add="addButton"
                                       fontSize="1.6rem"
                                       :style="buttonStyle"
                                       style="right: 0">
              </button-change-cart-icon>
              <button-change-cart-disable v-if=" !goodsPrice || !props.stockCount" style="top:0.3rem">
              </button-change-cart-disable>

              <button-change-cart-add-sub v-if=" goodsPrice && props.stockCount > 0 && props.number > 0"
                                          :add="addButton"
                                          :number="  props.number "
                                          :sub="props.sub"
                                          :goodsUnit="props.goodsType == 7 ? 'g' : ''"
                                          style="top:0.5rem">
              </button-change-cart-add-sub>

            </div>
          </update-cart>
        </div>
      </div>
    </div>
  </li>
</template>

<script>
  import UpdateCart from '@/real-components/UpdateCart/CartForFood.vue'
  import lazyLoad from 'vue-lazyload'
  import ButtonChangeCartIcon from '@/real-components/ButtonChangeCart/icon'
  import ButtonChangeCartDisable from '@/real-components/ButtonChangeCart/Disable'
  import ButtonChangeCartAddSub from '@/real-components/ButtonChangeCart/AddSub'
  import minxinAuto from './mixinAuto.vue'

  export default {
    data() {
      return {
        buttonType: 0
      }
    },
    mixins: [minxinAuto],
    components: {UpdateCart, ButtonChangeCartIcon, ButtonChangeCartDisable, ButtonChangeCartAddSub},
  }
</script>

<style scoped>
  .cjy-page-body-commodity-li {
    position: relative;
    width: 100%;
  }

  .cjy-page-image-box {
    width: 34%;
    height: 0;
    position: relative;
    padding-bottom: 33%;
    overflow: hidden
  }

  .cjy-page-Info-box {
    width: 66.8%;
    position: relative;
    padding: 0 0.3rem;
    height: 100%;
    padding-bottom: 0.4rem;

  }

  .cjy-item-line {
    border-bottom: 1px solid #E8E8E8;
  }

  .cjy-label-box {
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.2rem 0;
    height: 1.2rem;
    display: flex;

  }
  .cjy-label-box-weighing{
    font-size: 0.6rem;
    text-align: left;
  }

  .cjy-label-box-left, .cjy-label-box-right {
    display: flex;
    max-width: 42%;
    flex-direction: column;
    justify-content: space-between;
    align-items: self-start;
  }

  .cjy-label-box-middle {
    width: 1px;
    height: 100%;
    padding: 0.1rem 0.5rem;
  }

  .cjy-label-box-middle::after {
    content: '';
    background: #ddd;
    display: block;
    height: 100%;
    width: 1px;
  }

  .cjy-page-body-commodity-li > div {
    width: 100%;
    padding-top: 0.4rem;
    background: white;
    overflow: hidden;
  }

  .cjy-page-bod-commodity-box {
    width: 100%;
    position: relative;
    display: flex;
  }

  .cjy-page-title-box, .cjy-page-label-box, .cjy-page-price-box, .cjy-page-subtitle-box {
    text-align: left;
  }

  .regular-label {
    display: inline-block;
    border-radius: 2px;
    border: 0.5px solid #ff2600;
    font-size: 0.5rem;
    padding: 0 0.1rem;
    overflow: hidden;
    margin-right: 0.2rem;
  }

  .cjy-page-title-box {
    color: black;
    font-size: 0.6rem;
    line-height: 0.8rem;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }

  .cjy-page-subtitle-box {
    color: #777777;
    font-size: 0.35rem;
    line-height: 0.7rem;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }

  .cjy-page-label-box {
    height: 1rem;
    font-size: 0.6rem;
    color: #ff2600;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }
  .cjy-page-label-box p{
    height: 1rem;
    font-size: 0.6rem;
    color: #ff2600;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }

  .cjy-page-label-box > .cjy-label {
    display: inline-block;
    border-radius: 0.3rem;
    border: 1px solid #ff2600;
    font-size: 0.5rem;
    color: #ff2600;
    padding: 0px 0.2rem;
  }

  .normal-price {
    text-align: left;
    padding-left: 0.1rem;
    font-size: 0.6rem;
    text-decoration-style: solid;
    text-decoration-line: line-through;
    color:#6b6b6b;
  }

  .cjy-page-price-box {
    position: relative;
    bottom: 0;
    width: 100%;
    font-size: 0.8rem;
    color: #444;
  }

  .cjy-page-price-box > .cjy-price {
    font-size: 0.9rem;
    font-weight: 400;
    color: #ff2600;
    display: inline-block;
  }

  .cjy-page-price-box > .cjy-price-unit {
    color: #777777;
    font-size: 0.6rem;
  }

  .cjy-button-box-go-detail {
    float: right;
    position: relative;
    padding: 0 0.3rem;
    font-size: 0.7rem;
    font-weight: 400;
    height: 1rem;
    line-height: 1rem;
    color: #fff;
    margin-top: 0.3rem;
  }

  .cjy-add-cart-button-box {
    height: 1.6rem;
    min-width: 1.6rem;
    margin-right: 0.2rem;
    box-sizing: content-box;
    padding: 0.5rem 0;
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
  }

  .textOverflow {
    overflow: hidden;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }
</style>
